/*Copyright (C) 2013-2022 LZE*/
#include<bits/stdc++.h>
#define fo(x) freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);
#define INF 0x7fffffff
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int N = 10000010;
const int M = 100010;
const double Pi = acos(-1.0);
ll T,n,m;
struct Complex_Number{
    double real,imag;
    Complex_Number(){}
    Complex_Number(double num1,double num2) : real(num1) , imag(num2) {}
}poly1[N],poly2[N],poly[N];
Complex_Number operator + (const Complex_Number &num1,const Complex_Number &num2){
    return Complex_Number(num1.real + num2.real,num1.imag + num2.imag);
}
Complex_Number operator - (const Complex_Number &num1,const Complex_Number &num2){
    return Complex_Number(num1.real - num2.real,num1.imag - num2.imag);
}
Complex_Number operator * (const Complex_Number &num1,const Complex_Number &num2){
    return Complex_Number(num1.real * num2.real - num1.imag * num2.imag,num1.real * num2.imag + num1.imag * num2.real);
}
void FFT(Complex_Number * p,ll len,bool IDFT){
    if(len == 1)return;
    for(ll i = 0;i < len;i++)poly[i] = p[i];
    Complex_Number * lp = p,* rp = p + (len >> 1);
    for(ll i = 0;i < (len >> 1);i++){
        lp[i] = poly[i << 1]; rp[i] = poly[i << 1 | 1];
    }
    FFT(lp,len >> 1,IDFT);
    FFT(rp,len >> 1,IDFT);
    Complex_Number unitroot(cos(2.0 * Pi / len),sin(2.0 * Pi / len));
    if(IDFT)unitroot.imag *= -1;
    Complex_Number w(1.0,0.0),t;
    for(ll i = 0;i < (len >> 1);i++){
        t = w * rp[i];
        poly[i] = lp[i] + t;
        poly[i + (len >> 1)] = lp[i] - t;
        w = w * unitroot;
    }
    for(ll i = 0;i < len;i++)p[i] = poly[i];
}
int main(){
    scanf("%lld%lld",&n,&m);
    for(ll i = 0;i <= n;i++)scanf("%lf",&poly1[i].real);
    for(ll i = 0;i <= m;i++)scanf("%lf",&poly2[i].real);
    for(m += n,n = 1;n <= m;n <<= 1);
    FFT(poly1,n,false); FFT(poly2,n,false);
    for(ll i = 0;i < n;i++)poly1[i] = poly1[i] * poly2[i];
    FFT(poly1,n,true);
    for(ll i = 0;i <= m;i++)printf("%lld ",ll(poly1[i].real / n + 0.45));
    return 0;
}
